//
//  LaunchScrollItemCell.swift
//  koolcar
//
//  Created by xiantian on 2023/9/18.
//

import UIKit
import FSPagerView

class LaunchItemCell: FSPagerViewCell {
    var imgView: UIImageView!
    var titleLab: UILabel!
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.contentView.layer.shadowOpacity = 0
        self.contentView.layer.shadowOffset = .zero
        
        imgView = UIImageView()
        imgView.contentMode = .scaleAspectFit
        imgView.backgroundColor = UIColor.clear
        contentView.addSubview(imgView)
        
        titleLab = UILabel()
        titleLab.textColor = Theme.mainColor
        titleLab.font = UIFont.init(name: Theme.PingFangSCMedium, size: 20)
        titleLab.numberOfLines = 1
        titleLab.lineBreakMode = .byTruncatingTail
        titleLab.textAlignment = .center
        titleLab.backgroundColor = UIColor.clear
        contentView.addSubview(titleLab)
        
        self.addSnpLayout()
    }
    
    func addSnpLayout(){
        imgView.snp.makeConstraints { make in
            make.left.equalTo(0)
            make.width.equalTo(kScreenWidth)
            make.top.equalTo(0)
        }
        
        titleLab.snp.makeConstraints { make in
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.top.equalTo(imgView.snp.bottom).offset(20)
            make.height.greaterThanOrEqualTo(30)
            make.bottom.equalTo(0)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
